package projorientado.image;

import java.awt.Rectangle;

/**
 * Representa um segmento de uma imagem, que corresponde a uma imagem do segmento e um retangulo que o circunda.
 */
public class Segment {

    private ImageLayerData imageLayer;
    private Rectangle rectangle;

    public Segment() {
    }

    public Segment(ImageLayerData imageLayer, Rectangle rectangle) {
        this.imageLayer = imageLayer;
        this.rectangle = rectangle;
    }

    public ImageLayerData getImageLayer() {
        return imageLayer;
    }

    public void setImageLayer(ImageLayerData imageLayer) {
        this.imageLayer = imageLayer;
    }

    public Rectangle getRectangle() {
        return rectangle;
    }

    public void setRectangle(Rectangle rectangle) {
        this.rectangle = rectangle;
    }
    
    public void copyInOriginalPosition(ImageLayerData image) {
        image.draw(imageLayer, (int)rectangle.getX(), (int)rectangle.getY());
    }
    
}
